Skip to main content

Setup Logpush on Cloudflare Manually

IO River can provide extensive traffic analytics, even if you still manage the domain on Cloudflare. To do that, add Logpush to your domain to deliver sample traffic to IO River.

Prefer automation? See Automate with Script.

Process

In the Cloudflare Dashboard, open your domain, and navigate to Investigate > Log Push, and click Create a Logpush Job.

  • In the Select Destination step
    • Select HTTP Destination
  • In the Enter destination details step
  • In the Select Dataset step
    • Select HTTP Requests
  • In the Configure logpush job step
    • Enter a Job name, such as Send sample logs to IO River
    • Set If logs match to Filtered logs
    • Set the criteria
      • Set Field to ClientRequestSource
      • Set Operator to equals
      • Set Value to eyeball
    • In the Send the following fields section, select the following fields
      • General: RayID
      • Cache: CacheCacheStatus
      • Request: ClientASN, ClientCountry, ClientIP, ClientRequestHost, ClientRequestMethod, ClientRequestPath, ClientRequestProtocol, and ClientRequestURI
      • Performance: EdgeEndTimestamp, EdgeStartTimestamp
      • Response: EdgeResponseBytes, EdgeResponseStatus
    • Open Advanced Options
      • Set Timestamp format to unixnano
      • Enable the Push a randomly-sampled percentage of logs checkbox
      • Set the sampling rate to 1%
      • Set Log delivery method to Core
    • Click Submit

Automate with Script

You can automate this setup (create a Logpush job) by downloading and running the script below:

Example:

# Option 1 (recommended): Cloudflare API token
python3 create_cloudflare_logpush.py <your_domain> \
--account-provider-id <your_account_provider_id> \
--api-token <your_cloudflare_api_token>

# Option 2: Cloudflare Global API key + account email
python3 create_cloudflare_logpush.py <your_domain> \
--account-provider-id <your_account_provider_id> \
--api-email <your_cloudflare_email> \
--api-key <your_cloudflare_global_api_key>

# Option 3: credentials from environment variables
export CLOUDFLARE_API_TOKEN=<your_cloudflare_api_token>
python3 create_cloudflare_logpush.py <your_domain> \
--account-provider-id <your_account_provider_id>

Notes:

  • <your_domain> is the Cloudflare zone name (for example: example.com).
  • Required Cloudflare permissions: Logs Write and zone access for the target domain.
  • Add --dry-run to print the payload without creating a Logpush job.